package cn.ming.wfchat.app.dynamic.adpter;

import android.text.TextUtils;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import cn.ming.wfchat.R;
import cn.ming.wfchat.app.utils.ImageLoaderUtil;
import cn.ming.wfchat.kit.contact.model.UIUserInfo;

/**
 * @author luoming
 * created at 2019/8/27 6:09 PM
 */

public class NetWorkListAdapter extends BaseQuickAdapter<UIUserInfo, BaseViewHolder> {


    public NetWorkListAdapter() {
        super(R.layout.net_work_list_item);
    }


    @Override
    protected void convert(BaseViewHolder helper, UIUserInfo item) {
        ImageLoaderUtil.display(helper.getView(R.id.portraitImageView), item.getUserInfo().portrait);

        String name = "";
        if (!TextUtils.isEmpty(item.getUserInfo().groupAlias)) {
            name = item.getUserInfo().groupAlias;
        } else if (!TextUtils.isEmpty(item.getUserInfo().friendAlias)) {
            name = item.getUserInfo().friendAlias;
        } else if (!TextUtils.isEmpty(item.getUserInfo().displayName)) {
            name = item.getUserInfo().displayName;
        }
        helper.setText(R.id.nameTextView, name);
        helper.addOnClickListener(R.id.tv_join);
    }
}
